#include "tplgetexpression.h"

TplGetExpression::TplGetExpression(QObject *parent):TplUnaryExpression(parent) {
}

TplGetExpression::~TplGetExpression() {
#ifdef TPL_DEBUG
    qDebug() << "Deleting object TplGetExpression: " << this << endl;
#endif
}

QVariant TplGetExpression::evaluate(bool *ok) {
    const QString &name = this->value.toString();
    if(context->contains(name)) {
        *ok = true;
        return QVariant((*context)[name]);
    }

    qFatal("Context does not countain value: %s at: %s@%d", name.toUtf8().data(), __FILE__,__LINE__);
    *ok = false;
    return 0;
}
